const sideRoute = [
        {
            code: 'zysp',
            icon: 'res',
            children: [
                {
                    code: 'ygjzysp',
                    path: '/manager/demand'
                },
                {
                    code: 'wgjzysp',
                    path: '/manager/off-demand'
                }
            ]
        },
        {
            code: 'gxsq',
            icon: 'application',
            children: [
                {
                    code: 'ygjzysq',
                    path: '/manager/application'
                },
                {
                    code: 'wgjzysq',
                    path: '/manager/off-application'
                }
            ]
        },
        {
            code: 'zygl',
            icon: 'manage',
            children: [
                {
                    code: 'zyml',
                    path: '/manager/res-list'
                },
                {
                    code: 'wdzy',
                    path: '/manager/authorization'
                }
            ]
        },
        {
            code: 'yygl',
            icon: 'sys',
            children: [
                {
                    code: 'wdyy',
                    path: '/manager/selfBuilt'
                },
                {
                    code: 'ipxgsqd',
                    path: '/manager/ipAmendment'
                },
                {
                    code: 'sjygl',
                    path: '/manager/dataManage'
                }
            ]
        },
        {
            code: 'hdjl',
            icon: 'sys',
            children: [
                {
                    code: 'sjxqywtfk',
                    path: '/exchange/data-requirement'
                },
                {
                    code: 'xqhf',
                    path: '/exchange/need-reply'
                }
            ]
        },
        {
            code: 'sjj-zygl',
            icon: 'manage',
            children: [
                {
                    code: 'sjj-ygjzysp',
                    path: '/sp-manager/demand'
                },
                {
                    code: 'sjj-wgjzysp',
                    path: '/sp-manager/off-demand'
                },
                {
                    code: 'sjj-ipxgsqd',
                    path: '/sp-manager/ip-amend'
                },
                {
                    code: 'sjj-zyml',
                    path: '/sp-manager/res-list'
                }
            ]
        },
        {
            code: 'sjj-hdjl',
            icon: 'sys',
            children: [
                {
                    code: 'sjj-sjxqywtfk',
                    path: '/exchange/data-requirement'
                },
                {
                    code: 'sjj-xqhf',
                    path: '/exchange/need-reply'
                }
            ]
        },
        {
            code: 'ss-zygl',
            icon: 'manage',
            children: [
                {
                    code: 'ygjssgd',
                    path: '/sp-manager/implement-order'
                },
                {
                    code: 'wgjssgd',
                    path: '/sp-manager/off-implement-order'
                },
                {
                    code: 'ipssgd',
                    path: '/sp-manager/implement-ip-order'
                }
            ]
        }
    ],
    topRoute = [
        {
            code: 'top-menu',
            icon: '',
            children: [
                {
                    code: 'top-gxsq',
                    path: '/res/list',
                    identify: 'resApply'
                },
                {
                    code: 'top-home',
                    path: '/res/home',
                    identify: 'home'
                },
                {
                    code: 'top-sqsp',
                    path: '/manager/application',
                    identify: 'resApproval'
                }
            ]
        }
    ],
    routeMatch = function (arr1, arr2) {
        function match(list1, list2) {
            let list = list1.map((e, i) => {
                list2.map((obj, j) => {
                    if (e.code === obj.code) {
                        e.icon = obj.icon
                        e.identify = obj.identify
                        if (!e.children) {
                            e = {...e, ...obj}
                        } else {
                            e.children = match(e.children, obj.children)
                        }
                    }
                })
                return e
            })
            return list
        }

        return match(arr1, arr2)
    }

export default {
    sideRoute,
    topRoute,
    routeMatch
}
